<?php if ($this->beginCache('cache_outer_div', ['duration' => 20])) { ?>
    <div id="cache_outer_div">
        <div>这里是外层，待会会被缓存</div>
        <?php if ($this->beginCache('cache_inner_div', ['duration' => 5])) { ?>
            <div id="cache_inner_div">
                <div>这里是内层，待会会被缓存</div>
            </div>
            <?php
            $this->endCache();
        }
        ?>
    </div>
    <?php
    $this->endCache();
}
?>
<div id="no_cache_dir">
    <div>这里不会被缓存</div>
</div>